﻿<!--#include file="../../client_inc/common.function.asp" -->
<!--#include file="../../client_inc/common.class.asp" -->

<%
if RZ_IN<>1 then
	response.write("非法请求")
	response.end
end If

Function checkadmin(i)
	If session("user_name")="" Or IsEmpty(session("user_name")) Or request.Cookies("user_name")="" Or IsEmpty(request.Cookies("user_name")) or request.Cookies("randomstring")<>session("randomstring") Then
		response.redirect("login.asp")
		response.End
	End If 
	If session("user_level")<i or request.Cookies("user_level")<i Then 
		response.write("޲<a href=admin_home.asp>权限不够</a>")
		response.End
	End If 
End Function 

Function historygoback(msg)
	response.write("<script type='text/javascript' language='javascript'>alert('"&msg&"');history.go(-1);</script>")
	response.end
End Function

Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	If 0 = Err Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function

'创建多级目录
Function CreateFolders(ByVal FolderPath) 
	Dim SuccessFlag
	SuccessFlag = False
	Dim objFSO 
	On Error Resume Next 
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
	If Err Then 
		Err.Clear() 
		Exit Function 
	End If 
	Dim RZFolderPath ' 目录路径
	RZFolderPath = FolderPath 
	If Right(RZFolderPath, 1) = "/" Then 
		RZFolderPath = Left(RZFolderPath, Len(RZFolderPath) -1) 
	End If 
	Dim FoldersArray '目录数组
	FoldersArray = Split(RZFolderPath, "/")  
	Dim i, j, SubFolder, AbsolutePath 
	For i = 0 To UBound(FoldersArray) 
		SubFolder = "" 
		For j = 0 To i 
			SubFolder = SubFolder & FoldersArray(j) & "/" 
		Next 
		AbsolutePath = Server.MapPath(SubFolder) 
		If Not objFSO.FolderExists(AbsolutePath) Then 
			objFSO.CreateFolder(AbsolutePath) 
		End If 
	Next 
	If Err Then 
		Err.Clear() 
	Else 
		SuccessFlag = True 
	End If 
	CreateFolders = SuccessFlag 
End Function

'计算分页
Function CaculatePage(rcount,pagesize)
	If rcount<=0 then
		CaculatePage=1
	Else
		If rcount mod PageSize =0 Then
			CaculatePage = CLng(rcount \ pagesize)
		Else
			CaculatePage = CLng(rcount \ pagesize )+1
		End If
	End If
End Function 

Function LongSpaceStr()  ''制造一个长空字符串
	LongSpaceStr = ""
	Dim i
	For i=1 To 256
		LongSpaceStr = LongSpaceStr& " "
	Next
End Function

Function DeleteHtml(filepath)
dim objFSO
Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
If Err.Number=-2147221005 Then 
	Response.Write "您的主机不支持FSO,请手工删除html文件"
	Err.Clear
	Exit Function 
End If
If objFSO.Fileexists(Server.Mappath(GetPath(filepath))) Then
	objFSO.Deletefile(Server.Mappath(GetPath(filepath)))
End If
Set objFSO=Nothing 
End Function 



Function  DeleteFolder(path)
	Dim fso, tmpfolder, tmpfile, tmpfiles, tmppath
	tmppath=GetPath(path)
	Set fso=server.CreateObject("Scripting.FileSystemObject")
	If fso.FolderExists(Server.MapPath(tmppath)) Then 
		Set tmpfolder = fso.GetFolder(Server.MapPath (tmppath))
		Set tmpfiles = tmpfolder.files
		For Each tmpfile In tmpfiles
			fso.DeleteFile (tmpfile)
		Next 
		Set tmpfiles=Nothing 
		Set tmpfolder=Nothing 
		fso.DeleteFolder (server.MapPath (tmppath))
	End If 
	Set fso=Nothing 
End Function 

%>